<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="../jquery/jquery-1.11.3.js"></script>
<link rel="stylesheet" href="../CSS/JobUser.css">
<style >
	 #In-table{
	 	border: 1;
		width:500px;
		height:50px;
		margin-top:20px;
	 }
	 blockquote{
	 	font-size:15px;
	 }
	 #check{
	 	position:fixed;
	 	width:500px;
	 	height:350px;
	 	background:#DDDDDD;
	 	top:150px;
	 	left:400px;
	 	z-index:100;
	 	
	 }
	 .check-title-pic{
	 	width:100px;
	 	margin-left:470px;
	 }
	 .check-title{
		width:100%;
		height:30px;
		background:#00DDDD;
	 }
	 
	 .check-body{
	 	width:85%;
	 	height:80%;
	 	background:#DDDDDD;
	 	margin-left:44px;
	 	margin-top:-11px;
	 }
	 #Content{
	 	position:relative;
	 }
	 
	 #check ul{
	 	height:100%;
	 	width:250px;
	 	margin-left:130px;
	 	margin-top:25px;
	 }
	 #check li{
	 	list-style-type:none;
	 	margin-top: 20px;
	 }
	 input{
	 	width:180px;
	 	height:20px;
	 	margin:5px 3px 5px 3px;
	 }
	 button{
	 	margin-top:10px;
	 	
	 	width:60px;
	 }
	 .text-left{
	 	
	 	font:normal 17px 微软雅黑;
	 	display: inline-block;
	 	text-align: left;
	 	width: 100px;
	
	 		
	 }
	 #command{
	 	position:fixed;
	 	width:500px;
	 	height:200px;
	 	background:#DDDDDD;
	 	top:100px;
	 	left:350px;
	 	z-index:100;
	 }
	  .command-title-pic{
	 	width:100px;
	 	margin-left:470px;
	 }
	 .command-title{
		width:100%;
		height:30px;
		background:#00DDDD;
	 }
	 .command-content{
	 	width:85%;
	 	height:78%;
	 	background:#DDDDDD;
	 	margin-left:44px;
	 	margin-top:-11px;
	 }
	 .text-right{
	 	font:normal 17px 微软雅黑;
	 	display: inline-block;
	 	text-align: left;
	 	width: 100px;
	 	
	 }
	  #command ul{
	 	height:100%;
	 	width:250px;
	 	margin-left:100px;
	 	margin-top:25px;
	 }
	 #command li{
	 	list-style-type:none;
	 	margin-top: 20px;
	 }
	 .text-command{
		font:normal 20px 微软雅黑;
		
	 
	 	width: 100%;
	 }
	 .button-command{
	 	margin-top: 15px;
	 	padding: 7px 13px 7px 13px;
	 	cursor: hand;
    	color: white;
    	background-color:#00DDDD;
	 	width: 65px;
	 	font: bold 15px 微软雅黑;
	 }
	 input{
	 	width: 85%;
	 }
	</style>
<title>工作岗位</title>
</head>
<body>
	<div id="Header">
		<div class="Header-Logo">
			<a href="http://www.baidu.com">
				<img src="../images/yy.png" alt="YY招聘网">
			</a>
		</div>
		<div class="Header-Logo-Right">
			<ul>
				<li>
					<a href="CompanyAllJob.html">招聘情况</a>
				</li><li>
					<a id="getCompany" href="alertJob.html" >修改岗位</a>
				</li>
			</ul>
		</div>
	</div>
	<div id="Content">
		<div class="Content-Background"></div>
		<div class="Content-Background-Content">
			<div id="Content-Title">
			<span class="Title-span">简历序号</span>
			<span class="Title-span">简历人名</span>
			<span class="Title-span">应聘职位</span>
			</div>
			
			<div id="Main-Div" ></div>
			
			<div id="check" style="display: none;">
				<div class="check-title">
					<div class="check-title-pic">
					<a href="javascript:void(0)" onClick="closea()">
						<img width="25" height="25" alt="关闭" src="../images/maskdelete.png">
					</a> 
					</div>
				</div>
				
				<div class="check-body">
					<ul>
					<li>
						<span class="text-left">姓名:</span>
						<span id="NresumeName" class="text-right">
						</span>
					</li>
					<li>
						<span class="text-left">性别:</span>
						<span id="NresumeSex" class="text-right">
						</span>
					</li>
					<li>
						<span class="text-left">学校:</span>
						<span id="NresumeSchool" class="text-right">
						</span>
					</li>
					<li>
						<span class="text-left">联系方式:</span>
						<span id="NresumePhone"  class="text-right">
						</span>
					</li>
					<li>
						<span class="text-left">个人简介:</span>
						<span id="NresumeIntro" class="text-right">
						</span>
					</li>
					<li>
						<button onClick="command()" >评&nbsp;价</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onClick="cancel()">取&nbsp;消</button>
					</li>
				</ul>
				</div>
			
			</div>
			
			<div id="command" style="display:none">
				<div class="command-title">
					<div class="command-title-pic">
					<a href="javascript:void(0)" onClick="closeb()">
						<img width="25" height="25" alt="关闭" src="../images/maskdelete.png">
					</a> 
					</div>
				</div>
				<div class="command-content">
					<ul>
						<li>
							<span class="text-command">请输入对该应聘者的评价</span>
						</li>
						<li>
							<input type="text" id="resumeDTO.resumeState" name="resumeDTO.resumeState" class=""/>
						</li>
						<li>
							<button onClick="SendCommand()" class="button-command">确&nbsp;&nbsp;定</button>
						</li>
					</ul>
				</div>
			</div>

			</div>
			<div>
			</div>
	</div>

	
	<script>
		var mark = JSON.parse(sessionStorage.jId);
		var jobId=mark.id ;
		var jobName = mark.name;
		alert("jobId+"+jobId);
		alert("jobName+"+jobName);
		var ResumeJson;
		var Num;
		var fact;
		 $.ajax({
			type : "GET",
			url: "../Resume/getAllResume.action?JobId="+jobId,
			dataType : "json",
			success:function(data){
				ResumeJson = data;
				
				Num=data.num;
				alert(Num);
				
				$.makeDiv();
				
			},
			error:function(jqXHR){
				alert("发生错误： "+jqXHR.status);
			}
		}); 
		
		$.makeDiv=function(){
			var resumeNumber;
			var MainDiv=document.getElementById("Main-Div");
			for(var i=0;i<Num;i++)
			{
				resumeNumber=i+1;
				var resumeId=ResumeJson.data[i].resumeId;
				var userId=ResumeJson.data[i].userId;
				var resumeName=ResumeJson.data[i].resumeName;
				var resumeSex=ResumeJson.data[i].resumeSex;
				var resumePhone=ResumeJson.data[i].resumePhone;
				var resumeSchool=ResumeJson.data[i].resumeSchool;
				var resumeIntro=ResumeJson.data[i].resumeIntro;
				var resumeState=ResumeJson.data[i].resumeState;
				
				var NewDiv=document.createElement("Div");
				NewDiv.className="NewDiv";
				
				var mNumber=document.createElement("span");
				var mresumeName=document.createElement("span");
				var mjobName=document.createElement("span");
				var pA=document.createElement("a");
				
				mNumber.className="newspan1";
				mresumeName.className="newspan1";
				mjobName.className="newspan1";
				pA.className="AA";
				pA.innerHTML="详细情况";
				mNumber.innerHTML=resumeNumber;
				mresumeName.innerHTML=resumeName;
				mjobName.innerHTML=jobName;
				
				NewDiv.appendChild(mNumber);
				NewDiv.appendChild(mresumeName);
				NewDiv.appendChild(mjobName);
				NewDiv.appendChild(pA);
				MainDiv.appendChild(NewDiv);
				
				pA.setAttribute("href","javascript:void(0)");
				pA.setAttribute("id",resumeId+","+userId+","+resumeName+","+resumeSex+","+resumePhone+","+resumeSchool+","+resumeIntro+","+resumeState);
				pA.onclick=function(){
					postfunction("Jid",this.id);
				}
				
			}
			
		}
		function postfunction(name,value2){
			var mark2=value2.split(",");
			
			var rId=mark2[0];
			var uId=mark2[1];
			var rName=mark2[2];
			var rSex=mark2[3];
			var rPhone=mark2[4];
			var rSchool=mark2[5];
			var rIntro=mark2[6];
			var rState=mark2[7];
			alert(rName);
			alert(rPhone)
			var sendJson={
				"resumeId":rId,
				"userId":uId,
				"resumeName":rName,
				"resumeSex":rSex,
				"resumePhone":rPhone,
				"resumeSchool":rSchool,
				"resumeIntro":rIntro,
				"resumeIntro":rState
			};
			if(document.getElementById("check").style.display=="none"){
				document.getElementById("check").style.display="";
			//	document.getElementById("NresumeName").value=rName;
				document.getElementById("NresumeName").innerHTML=rName;
				document.getElementById("NresumeSex").innerHTML=rSex;
				document.getElementById("NresumeSchool").innerHTML=rSchool;
				document.getElementById("NresumePhone").innerHTML=rPhone;
				document.getElementById("NresumeIntro").innerHTML=rIntro;
				fact=rId;
			}
			else{
				document.getElementById("check").style.display="none";
				fact=0;
			}
		//	sessionStorage.setItem("resume",JSON.stringify(sendJson));
		//	location.href="";
		}
		function closea(){
			if(document.getElementById("check").style.display==""){
				document.getElementById("check").style.display="none";
				fact=0;
				
			}
		}
		function command(){
			if(document.getElementById("check").style.display==""){
				document.getElementById("check").style.display="none";
				if(document.getElementById("command").style.display=="none")
				{
					document.getElementById("command").style.display="";
					document.getElementById("resumeDTO.resumeState").value="";
				}
				
			}
			
		}
		function cancel(){
			if(document.getElementById("check").style.display==""){
				document.getElementById("check").style.display="none";
			}
		}
		function closeb(){
		
			if(document.getElementById("command").style.display==""){
				document.getElementById("command").style.display="none";
			}
		}
		function SendCommand(){
			var	SendState=document.getElementById("resumeDTO.resumeState").value;
			alert("resumeID+"+fact);
			alert("State+"+SendState);
			 var sendJson={
				"resumeId":fact,
			 	"state":SendState
			};
			var request = new XMLHttpRequest();
			var type = "POST";
			var URL = "../Resume/addCommand.action";
			request.open(type,URL);
			
			request.onreadystatechange = function(){
				if(request.readyState===4 && request.status===200){
					var type = request.getResponseHeader("Content-Type");
    				if(type.indexOf("xml")!==-1 && request.responseXML){		//Document对象响应
    					alert("yesss");
    				}
    				else if(type === "application/json"){						//JSON响应	
    					alert("000000000");
    				}
    				else{														//字符串响应
    					var mark = request.responseText;
						if(mark != 0){									//字符串与数字进行比较，先将字符串转换成数字，然后使用转换后值进行比较
							alert("提交成功！");
							document.getElementById("command").style.display = "none";
						}
    				}
				}
			};
			request.setRequestHeader("Content-Type","application/json");
			request.send(JSON.stringify(sendJson));	
		}
	</script>
</body>
</html>